package com.xinsoft.entity.dto;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.xinsoft.constant.Const;
import com.xinsoft.entity.vo.ErpPurchaseNoticeVO;
import com.xinsoft.entity.vo.ErpSourcingFeedingVO;
import com.xinsoft.utils.RedisUtil;
import lombok.Data;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * 采购收料通知
 * */
@Data
public class KisPurchaseNoticeHeadDto {

    private String   FInterId;
    private String   FBillNo;       //编    号
    private String   FSupplyID;       //供应商
    private String   FCurrencyID;       //币    别
    private String   FSelTranType;       //源单类型
    private String   FCheckerID;       //审核
    private String   FCheckDate;       //审核日期
    private String   FFManagerID;       //主管
    private String   FDeptID;       //部门
    private String   FEmpID;       //业务员
    private String   FBillerID;       //制单

    private String   FAreaPS;       //采购范围
    private String   FFetchAdd;       //交货地点
    private String   FStockID;       //收料仓库
    private String   FRelateBrID;       //供货机构
    private String   FExplanation;       //摘要
    private String   FExchangeRate;       //汇    率
    private String   FMultiCheckLevel1;       //一审
    private String   FMultiCheckDate1;       //一审日期
    private String   FWWType;       //委外类型
    private String   FBizType;       //业务类型
    private String   FPOStyle;       //采购方式
    private String FClosed; // 关闭状态
    private String FCancellation; // 是否作废

    private RedisUtil redisUtil = SpringUtil.getBean(RedisUtil.class);

    public ErpPurchaseNoticeVO voToPo(KisPurchaseNoticeHeadDto item) {
        if (item == null) {
            return null;
        }
        ErpPurchaseNoticeVO erpPurchaseNoticeVO = new ErpPurchaseNoticeVO();
        erpPurchaseNoticeVO.setId(ObjectUtil.isEmpty(item.getFInterId()) ? null : new Integer(item.getFInterId()));
        erpPurchaseNoticeVO.setCode(item.getFBillNo());
        erpPurchaseNoticeVO.setSupplyID(ObjectUtil.isEmpty(item.getFSupplyID()) ? null : new Integer(item.getFSupplyID()));
        erpPurchaseNoticeVO.setAuditorId(ObjectUtil.isEmpty(item.getFCheckerID()) ? null : new Integer(item.getFCheckerID()));
        erpPurchaseNoticeVO.setCheckDate((ObjectUtil.isEmpty(item.getFCheckDate()) ? null : DateUtil.formatDate(DateUtil.parse(item.getFCheckDate(),redisUtil.get(Const.TIME_FORMAT).toString()))));
        erpPurchaseNoticeVO.setManagerId(ObjectUtil.isEmpty(item.getFFManagerID()) ? null : new Integer(item.getFFManagerID()));
        erpPurchaseNoticeVO.setDeptID(ObjectUtil.isEmpty(item.getFDeptID()) ? null : new Integer(item.getFDeptID()));
        erpPurchaseNoticeVO.setBuyerId(ObjectUtil.isEmpty(item.getFEmpID()) ? null : new Integer(item.getFEmpID()));
        erpPurchaseNoticeVO.setCreateId(ObjectUtil.isEmpty(item.getFBillerID()) ? null : new Integer(item.getFBillerID()));
        return erpPurchaseNoticeVO;
    }

//    {
//        \"FBrNo\": \"0\",
//        \"FInterID\": \"2620\",
//        \"FBillNo\": \"DD001474\",
//        \"FCurrencyID\": \"1\",
//        \"FTranType\": \"72\",
//        \"FSupplyID\": \"253\",
//        \"FDeptID\": \"4072\",
//        \"FEmpID\": \"3990\",
//        \"FDate\": \"4/9/2020 12:00:00 AM\",
//        \"FStockID\": \"\",
//        \"FPosterID\": \"\",
//        \"FCheckerID\": \"16412\",
//        \"FBillerID\": \"16412\",
//        \"FFManagerID\": \"0\",
//        \"FSManagerID\": \"\",
//        \"FCnnBillNo\": \"\",
//        \"FBizType\": \"12510\",
//        \"FClosed\": \"0\",
//        \"FNote\": \"\",
//        \"FInvoiceClosed\": \"0\",
//        \"FBClosed\": \"0\",
//        \"FCreateDate\": \"\",
//        \"FCheckDate\": \"4/9/2020 12:00:00 AM\",
//        \"FExchangeRate\": \"1\",
//        \"FStatus\": \"3\",
//        \"FCancellation\": \"False\",
//        \"FUpStockWhenSave\": \"False\",
//        \"FPOStyle\": \"252\",
//        \"FMultiCheckLevel1\": \"\",
//        \"FMultiCheckLevel2\": \"\",
//        \"FMultiCheckLevel3\": \"\",
//        \"FMultiCheckLevel4\": \"\",
//        \"FMultiCheckLevel5\": \"\",
//        \"FMultiCheckLevel6\": \"\",
//        \"FMultiCheckDate1\": \"\",
//        \"FMultiCheckDate2\": \"\",
//        \"FMultiCheckDate3\": \"\",
//        \"FMultiCheckDate4\": \"\",
//        \"FMultiCheckDate5\": \"\",
//        \"FMultiCheckDate6\": \"\",
//        \"FCurCheckLevel\": \"\",
//        \"FRelateBrID\": \"0\",
//        \"FExplanation\": \"\",
//        \"FFetchAdd\": \"\",
//        \"FSelectBillNo\": \"\",
//        \"FSelTranType\": \"71\",
//        \"FChildren\": \"2\",
//        \"FBrID\": \"\",
//        \"FTranStatus\": \"0\",
//        \"FAreaPS\": \"20302\",
//        \"FReStatus\": \"\",
//        \"FPOOrdBillNo\": \"\",
//        \"FManageType\": \"0\",
//        \"FWWType\": \"0\",
//        \"FPrintCount\": \"0\"
//    }

}
